import router from './routers'
import {param2Obj} from '@/utils'
import {setToken} from '@/utils/auth'
import {setCookie} from '@/utils/cookie'

router.beforeEach((to, from, next) => {
  const {token, org_id} = param2Obj(window.location.href)
  // 获取token
  if (token) setToken(`${decodeURIComponent(token)}`)
  // 获取org_id
  if (org_id) setCookie('org_id', `${decodeURIComponent(org_id)}`)
  next()
})